package com.xpy.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnSqlServer {
    public static Connection getConnection() throws ClassNotFoundException, SQLException {
        // 数据库连接信息
        String url = "jdbc:sqlserver://localhost:1433;databaseName=mydb";
        String dbUsername = "sa";
        String dbPassword = "1";
        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        return DriverManager.getConnection(url, dbUsername, dbPassword);
    }
}
